// package/pages/rechargeSuccess/rechargeSuccess.js
let myRequest = require('../../../common/script/myRequest.js');
let api = require('../../../common/script/api.js');
let login = require('../../../common/script/login');
const utils = require('../../../utils/util.js');
let app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    orderInfo: {},
  },


  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    const that = this;
    console.log(options,111)
    login.checkLogin().then(res => {
      that.getProvince(options.wx_order_sn);
    }).catch(err => {
      app.appCallBack = (e) => {
        that.getProvince(options.wx_order_sn);
      }
    })


  },
  getProvince(wx_order_sn) {
    const that = this;
    console.log(wx_order_sn,222)
    let data = {
      wx_order_sn
    }
    wx.showLoading({
      title: '加载中...',
    })
    myRequest.EasyHttp.post(api.reqUrls.payDetail, data).then(res => {
      wx.hideLoading();
      if (res.data.status == 1) {
        that.setData({
          orderInfo: res.data.result.detail
        })
      } else {
        wx.showToast({
          title: res.data.msg
        })
      }
      that.setData({
        hiddenLoading: true
      })
    })
  },



  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  // onShareAppMessage: function () {

  // }
})